Skip to content

[SPARK-58036][SQL] Delegate missing methods in AggregatedDialect to underlying dialects#57193

Open
marcuslin123 wants to merge 1 commit into
apache:masterfrom
marcuslin123:SPARK-58036-fix-aggregated-dialect
Open

[SPARK-58036][SQL] Delegate missing methods in AggregatedDialect to underlying dialects#57193
marcuslin123 wants to merge 1 commit into
apache:masterfrom
marcuslin123:SPARK-58036-fix-aggregated-dialect

Conversation

@marcuslin123

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add missing method overrides in AggregatedDialect that delegate to the underlying dialects, fixing cases where the generic JdbcDialect default is used instead of the database-specific implementation.

Methods now properly delegated:

  • compileValue — the reported bug (Oracle timestamps formatted incorrectly)
  • compileExpression — SQL expression pushdown
  • isSupportedFunction — function pushdown support (returns true if any dialect supports it)
  • getJdbcSQLQueryBuilder — SQL query builder
  • supportsLimit / supportsOffset / supportsHint / supportsJoin — query capability flags
  • getLimitClause / getOffsetClause — SQL clause generation
  • classifyException — error classification
  • renameTable — DDL generation
  • functions — custom SQL functions
  • createConnectionFactory — connection creation

Why are the changes needed?

When a user registers a custom JDBC dialect alongside a built-in one (e.g., Oracle), Spark combines them into an AggregatedDialect. However, AggregatedDialect only delegated ~11 methods to the underlying dialects — the rest fell through to the generic JdbcDialect defaults. This caused database-specific behavior (like Oracle's timestamp literal formatting) to be silently dropped, producing invalid SQL.

Does this PR introduce any user-facing change?

Yes. Users with custom JDBC dialects registered alongside built-in dialects will now get correct database-specific SQL generation for all delegated methods, instead of generic defaults that may produce invalid SQL.

How was this patch tested?

Added a new test "Aggregated dialects: delegation of compileValue and other methods" in JDBCSuite.scala that verifies compileValue, isSupportedFunction, supportsLimit, supportsOffset, getLimitClause, and getOffsetClause are properly delegated through the aggregated dialect.

Was this patch authored or co-authored using generative AI tooling?

Generative AI tooling (Claude Code) was used as an assistive tool for implementation guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant